package com.zou.application.controller.admin;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.zou.application.dao.UserEntityMapper;
import com.zou.application.entity.UserEntity;

@Controller(value="manageUser")
@RequestMapping("/admin/user")
public class UserController {
	
	@Autowired
	private UserEntityMapper userEntityMapper;
	
	/**
	 * 管理员账号登陆控制层
	 * @param request
	 * @return
	 */
	@RequestMapping("/userList")
	public ModelAndView userList(HttpServletRequest request){
		ModelAndView mv = new ModelAndView();
		Map<String, Object> param = new HashMap<String, Object>();
		try {
			List<UserEntity> userEntities = userEntityMapper.listByMap(param);
			mv.addObject("users",userEntities);
		} catch (Exception e) {
			e.printStackTrace();
		}
		mv.setViewName("/admin/user/user_list");
		return mv;
	}
}
